<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <title><?php echo $this->page_title; ?></title>
    <link rel="stylesheet" type="text/css" href="/style/css/base.css"/>
    <link rel="stylesheet" type="text/css" href="/style/css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="/style/css/xshop.css?ver=20180608"/>
    <script src="/style/js/jquery-1.12.0.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/style/js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/style/js/xShop.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="/style/js/sweet-alert.min.js"></script>
    <link type="text/css" rel="stylesheet" href="/style/css/sweet-alert.css">
    <script src="http://static.ydbimg.com/API/YdbOnline.js" type="text/javascript"></script>
</head>
<body>
<div class="outwrap">
    <div class="meinner-adr-add">
        <div class="adr-box-add">
            <div class="iptform">
                <form action="#" id="form_address">
                
                    <div class="item-ipt">
                        <span class="name">快递名称：</span>
                         <select name="return_shipping_name" id="return_shipping_name" class="txt">
                            <option value="">请选择快递名称</option>
                            <?php
                            if ($this->exlist) {
                                foreach ($this->exlist as $r) {
                                    if ($this->data['return_shipping_name'] == $r['company_name']) {
                                        $slk = ' selected';
                                    } else {
                                        $slk = '';
                                    }
                            
                                    ?>
                                                        <option value="<?=$r['company_name'];?>" data-id="<?=$r['id'];?>"<?=$slk;?>><?=$r['company_name'];?></option>
                                                        <?
                                }
                            }
                            ?>
                          </select>
                    </div>
                    <div class="item-ipt">
                        <span class="name">快递单号：</span><input name="return_shipping_id" id="return_shipping_id" type="text"
                                                              placeholder="退货快递单号" class="txt" value="<?= $this->data['return_shipping_id'] ?>"/>
                    </div>
                </form>
            </div>
            <div class="btnwrap">
                <input type="button" class="btn-mexl btn-bc" value="保存" onClick="submitAddress()"/>
            </div>
        </div>
    </div>


</div>
<script type="text/javascript">

    function submitAddress() {

        var _do = true;

        if ($("#return_shipping_id").prop("value") == "") {
            swal("请填写快递单号");
            _do = false;
        }
        if ($("#return_shipping_name").prop("value") == "") {
            swal("请填写快递名称");
            _do = false;
        }


        if (_do) {
            var order_id = <?=$this->data['order_id'];?>;
            $.post("ajax", {
                "act": "apply_return",
                "return_shipping_name": $("#return_shipping_name").prop("value"),
                "return_shipping_id": $("#return_shipping_id").prop("value"),
                "rec_id":<?=$this->data['rec_id'];?>,
                "order_id":order_id,
                "mr": Math.random()
            }, function (data) {
                //alert(JSON.stringify(data))
                if (data.code == 200) {
                    swal(data.msg, false, "success");
                    setTimeout(function() {
                    	location.href="/order/orderdetail?order_id="+order_id;
                    }, 2100);
                } else {
                    swal(data.msg+'['+data.code+']', false, "error");
                }
            },'json');
        }

    }


</script>
<script type="text/javascript">
    var YDB = new YDBOBJ();
    function OpenNewWindow() {
        YDB.OpenNewWindow();
    }
    YDB.SetReturnButtonMode(1);
    YDB.AnimationWay(0);
    YDB.SetMoreButton(0);
    YDB.SetDragRefresh(0);
</script>
<!--底部导航-->
<!-- <div class="foot-menu">
    <ul class="clearfix">
        <li><a href="/index"><i class="ico-1"></i><span>店铺</span></a></li>
        <li class="on"><a href="/myshop/order"><i class="ico-2"></i><span>订单</span></a></li>
        <li><a href="/im"><i class="ico-3"></i><span>对话</span></a></li>
        <li><a href="/mystore/myindex"><i class="ico-4"></i><span>更多</span></a></li>
    </ul>
</div> -->
</body>
</html>